From e86fb2c2bebec8bd8fb547b8551c3416fa5b0d85 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Wed, 5 Aug 2026 14:09:43 +0000 Subject: [PATCH] Add example query to ARRIVALS doc --- doc/src/tables/arrivals.m4 | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/doc/src/tables/arrivals.m4 b/doc/src/tables/arrivals.m4 index 71f35d3..48571ec 100644 --- a/doc/src/tables/arrivals.m4 +++ b/doc/src/tables/arrivals.m4 @@ -36,10 +36,6 @@ This related |EVENTS| row supplies arrival and departure time values, and the |ROLES| role related to the event supplies information on the individual arriving and departing. -.. sidebar:: - - |OBS helpful| - The system will generate a warning when there are 2 different arrival events for the same arriving individual, in the same follow, that have an |EVENTS|.\ |EVENTS.Certainty| of ``sdb_identity_certain``, with @@ -65,6 +61,40 @@ For further information, including additional data integrity rules, see the documentation of the :ref:`EVENTS ` table. +The |OBS| view is useful when querying ARRIVALS. + +.. code-block:: sql + :caption: + Using OBS and ROLES to provide a more complete picture of follow arrivals + + SELECT obs.wid, obs.type + , obs.eid + , roles.pid + , obs.date + , obs.animid AS focal + , roles.participant AS arrival + , obs.commid + , arrivals.seq + , obs.start AS arrived + , obs.stop AS departed + , obs.certainty + , arrivals.neststart + , arrivals.nestend + , arrivals.cycle + , arrivals.datasource + , arrivals.updated + , obs.notes + , obs.event_notes + FROM obs + JOIN arrivals + ON (arrivals.eid = obs.eid) + JOIN roles + ON (roles.eid = obs.eid) + WHERE obs.behavior = 'sdb_arrival' + ORDER BY roles.participant, obs.date, obs.start, obs.stop + , obs.eid; + + .. contents:: :depth: 2 -- 2.34.1